import { defineAsyncComponent } from 'vue'
import type { App } from 'vue'
import * as svg from '@element-plus/icons-vue'

const SvgIcon = defineAsyncComponent(
    () => import('@/components/svgIcon/index.vue'),
)

/**
 * 注册icon组件
 * @param app
 */
export function elSvg(app: App) {
    const icons = svg as any
    for (const i in icons) {
        app.component(`ele-${icons[i].name}`, icons[i])
    }
    app.component('SvgIcon', SvgIcon)
}
